/**
 * @param {number[]} numbers
 * @param {number} target
 * @return {number[]}
 */
var twoSum = function (numbers, target) {
  let left = 0
  let right = numbers.length - 1 // 左右指针
  while (left < right) {
    let sum = numbers[left] + numbers[right]
    if (target === sum) {
      return [left + 1, right + 1] // 如果相等返回位置
    } else if (target < sum) {
      // 如果目标小于和说明应该右指针左移
      right--
    } else {
      left++
    }
  }
  return [-1, -1]
};